﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddCommission.aspx.cs"
    Inherits="ZX.WebApp.Crm.Modules.AddCommission" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/extendTable.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table class="tableContent" id="DutyInfoTable">
            <tr style="display:none">
                <td style="height: 30px; width: 100px;">
                    <span style="color: Red">*</span>是否发放佣金
                </td>
                <td>
                    <asp:DropDownList ID="CommissionState" runat="server" Width="140">
                        <asp:ListItem Value="">--请选择--</asp:ListItem>
                        <asp:ListItem Value="1">暂时没有发放</asp:ListItem>
                        <asp:ListItem Value="2">已全部发放</asp:ListItem>
                        <asp:ListItem Value="3">已发放部分</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr style="display:none">
                <td style="height: 30px;">
                    <span style="color: Red">*</span>发放金额
                </td>
                <td>
                    <input type="text" id="CommissionPay" style="width: 150px;" runat="server" /> 
                </td>
            </tr>
            <tr>
                <td style="height: 30px;">
                    <span style="color: Red">*</span>发放日期
                </td>
                <td>
                    <input type="text" id="CommissionTime" runat="server" style="width: 150px;" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
<script type="text/javascript">
    var Entity = "", StrId = "<%=StrId %>",
    strOrderProductId = "<%=StrOrderProductId %>", strUserId = "<%=StrUserId %>",
        Url = "";


    function Save() {
       // var vStates = $("#CommissionState").val();
        var vEndTime = $("#CommissionTime").val();
      //  var vPay = $("#CommissionPay").val();
//        if (vStates == "") {
//            alert("请选择是否发放!");
//            $("#CommissionState").focus();
//            return;
//        }
//        else if (vStates == "1") {
//            alert("请操作其他数据!");
//            parent.closeWin();
//            return;
//        }
//        else if (vPay == ""||isNaN(vPay)) {
//            alert("发放金额应为数字!");
//            $("#CommissionPay").focus();
//            return;
//        }
//        else 
        if (vEndTime == "") {
            alert("发放日期不能为空!");
            $("#CommissionTime").focus();
            return;
        } else {
            Entity = getPar1("entity");
            if (Entity == "CrmProductPayValue_yitui" || Entity == "CrmCommision" ) {
                Url = "../../Extend/AjaxData/CustomOperating.aspx?entity=" + Entity + "&ID=" + StrId + "&action=update&CommissionTime=" + vEndTime + "&UserId=" + strUserId + "&OrderProductId=" + strOrderProductId;
            }          
            else {
                Url = "../../Extend/AjaxData/CustomOperating.aspx?entity=" + Entity + "&action=check&CommissionTime=" + vEndTime;
            
            }
           SaveData();
        }
    }
    function SaveData() {
        YAHOO.util.Connect.asyncRequest('POST', Url, {
            success: function (res) {
                var inventory;
                try {
                    inventory = res.responseText;
                    if (inventory == 1) {
                        alert("操作成功!");
                        parent.closeWin();
                    } else {
                        alert(inventory);
                    }
                }
                catch (e) {
                }
                finally {
                }
            },
            failure: function (error) {
                alert("数据错误：" + error.statusText);
            }
        }, null);
    }
    $(document).ready(function () {
        $('#CommissionTime').cld();
    });
</script>
</html>
